/**
 * 
 */
package com.google.code.netz.wfe.internal;

import com.google.code.netz.wfe.api.IWorkflowContext;
import com.google.code.netz.wfe.events.CaseEvent;
import com.google.code.netz.wfe.events.EventManager;
import com.google.code.netz.wfe.events.CaseEvent.CaseEventType;
import com.google.code.netz.wfe.model.ICase;
import com.google.code.netz.wfe.model.IResource;
import com.google.code.netz.wfe.model.State;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: ResumeCaseTask.java 17 2009-02-09 13:08:49Z rahul.thakur.xdev $
 */
public class ResumeCaseTask extends AbstractCaseTask {

	/**
	 * @param kase
	 * @param resource
	 */
	public ResumeCaseTask(ICase<?> kase, IResource resource) {
		super(kase, resource);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.model.ITask#execute(IWorkflowContext)
	 */
	@Override
	public void execute(IWorkflowContext workflowContext) {
		getCase().setCurrentState(State.STATE_RUNNING);
		EventManager.getInstance().dispatchEvent(new CaseEvent<ICase>(getCase(), CaseEventType.CASE_OPENED));
	}

}
